import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/archives/archives_person_center.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/archives/archives_person_footer.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/archives/archives_person_top.dart';
import 'package:flutter_eve_plugin/model/ye_xiu/achieves/archieves_ability_entity.dart';
import 'package:flutter_eve_plugin/pages/ye_xiu/archives/actions.dart';
import 'package:flutter_eve_plugin/store/main.dart';
import 'package:flutter_eve_plugin/store_vm/app_vm.dart';
import 'package:flutter_eve_plugin/utils/print_util.dart';
import 'package:flutter_redux/flutter_redux.dart';

class ArchivesPersonWidget extends StatelessWidget {
  const ArchivesPersonWidget({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AppStateViewModel>(
        onInit: (store) {
          store.dispatch(getPersonalData());
        },
        converter: (store) => AppStateViewModel(state: store.state),
        builder: (context, vm) {
          ArchievesAbilityEntity data = vm.state.yeXiuState?.archivesState?.abilityEntity;
//          todo 无法解析 列表为空
          logPrint('ArchievesAbilityEntity data ${data.data.length} ');
          return SingleChildScrollView(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                ArchivesPersonTopWidget(),
                ArchivesPersonCenterWidget(data: data,),
                ArchivesPersonFooterWidget(data: data,)
              ],
            ),
          );
        });
  }
}
